<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:composition template="templatecustomer.xhtml">
        <ui:define name="pagename">
            Package Tour Order
        </ui:define>
        <ui:define name="content">
            <script type="text/javascript">
                function checkFormOrderTour (form) {
                var TestVar = form.elements["orderTour:number"];
                var tax_id = parseFloat(TestVar.value);
                if(isNaN(tax_id)){
                    alert ("You have input Number");
                    return false;
                }
                return true;
            }
            </script>
            <h1 style="text-decoration: underline">PACKAGE TOUR ORDER</h1>
            <br/>
            <c:if test="#{packageTourBean.ptDetails != null}">
                <h:form id="orderTour">
                    <table>
                        <tr>
                            <td>
                                <img src="../admin/#{packageTourBean.ptDetails.images}" alt="images" width="150px" height="150px"/>
                            </td>
                            <td>
                                <b>Package Name: #{packageTourBean.ptDetails.packageName}</b> <br></br>
                                <b>Package Tour Name: #{packageTourBean.ptDetails.packageTourName}</b> <br></br>
                                <b>Price per ticket: #{packageTourBean.ptDetails.price}$</b> <br></br>
                                <b>Ticket: <h:inputText id="number" onblur="checkFormOrderTour(this.form)" value="#{packageTourBean.numberPeople}"></h:inputText></b> <br></br>
                                <b style="color: navy">Total: #{packageTourBean.numberPeople*packageTourBean.ptDetails.price}$</b>
                                <br></br>
                                <h:commandButton style="background-image: url(images/update.png);width: 80px;height: 34px" action="#{packageTourBean.actionUpdateOrder}"></h:commandButton>
                            </td>
                        </tr>
                    </table>

                    <br></br><br></br>
                    <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;margin: 0 0 0 150px" />
                    <br/>
                    <c:if test="#{sessionScope.customer == null}">
                        <h:outputText style="color: red; margin: 0 0 0 150px ;text-decoration: blink" value="You must login before making checkout"></h:outputText>
                    </c:if>
                    <c:if test="#{sessionScope.customer != null}">
                        <table style="margin: 0 0 0 150px">
                            <tr>
                                <td><b>CC Number :</b></td>
                                <td><p:inputText id="CCNumber" value="#{bankBean.ccNumber}"></p:inputText></td>

                            </tr>
                            <tr>
                                <td><b>PIN Code :</b></td>
                                <td><p:password id="PINCode" value="#{bankBean.pinCode}"></p:password></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td><b style="color: navy">Balance : <h:outputLabel id="Balance" value="#{bankBean.balance}"></h:outputLabel> $</b></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td><p:commandButton value="Check Balance" update="Balance" actionListener="#{bankBean.actionGetBalance}"></p:commandButton></td>
                            </tr>
                        </table>
                        <br/>
                        <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;margin: 0 0 0 150px" />
                        <br></br>
                        <h:commandButton value="CheckOut" style="margin: 0 0 0 150px" action="#{bankBean.actionCreateTourBooking(packageTourBean.ptDetails.packageTourID,packageTourBean.numberPeople,packageTourBean.numberPeople*packageTourBean.ptDetails.price)}"></h:commandButton>
                    </c:if>
                </h:form>
            </c:if>
            <c:if test="#{packageTourBean.ptDetails == null}">
                <br/>
                <b>NOT HAVE ANY PRODUCTS IN YOUR SHOPPING CART</b>
            </c:if>
        </ui:define>
    </ui:composition>
</html>

